﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
	<link href="../../dist/css/lanai-ui.min.css" rel="stylesheet" />
</head>
<body>
    <section class="content">
        <blockquote class="bg-gray-light blockquote-primary">bootstrap-treeview v1.2.0             
            <small><a href="http://www.jondmiles.com/bootstrap-treeview" target="_blank">Bootstrap-Tree</a></small></blockquote>
            <blockquote class="bg-gray-light blockquote-default">JQuery zTree core v3.5.17-beta.2               
                <small><a href="http://zTree.me/" target="_blank">zTree</a></small></blockquote>
        <div class="nav-tabs-vertical with-border">
						<ul class="nav nav-tabs">
              <li class="active"><a href="#a" data-toggle="tab">Bootstrap-Tree</a></li>
              <li><a href="#b" data-toggle="tab">zTree</a></li>
						</ul>
						<div class="tab-content">
              <div class="tab-pane active no-padding" id="a">
                  <div class="nav-tabs-custom no-shadow">
                      <ul class="nav nav-tabs line-tabs tabs-danger">
                          <li class="active"><a href="#tab_21" data-toggle="tab" aria-expanded="true">DEMO</a></li>
                          <li class=""><a href="#tab_31" data-toggle="tab" aria-expanded="false">JSON数据</a></li>
                      </ul>
                      <div class="tab-content">
                          <!-- /.tab-pane -->
                          <div class="tab-pane" id="tab_31">
                              <code> <pre>
        [
  {
  text: "Parent 1",
  nodes: [
  {
  text: "Child 1",
  nodes: [
  {
  text: "Grandchild 1"
  },
  {
  text: "Grandchild 2"
  }
  ]
  },
  {
  text: "Child 2"
  }
  ]
  },
  {
  text: "Parent 2"
  },
  {
  text: "Parent 3"
  },
  {
  text: "Parent 4"
  },
  {
  text: "Parent 5"
  }
  ];
                              </pre>
                              </code>
                          </div>

                          <div class="tab-pane active" id="tab_21">
                              <div class="box box-widget no-shadow">
                                  <div class="box-body">
                                      <div id="treeview1" class="treeview no-radius-childs"></div>
                                  </div>
                              </div>
                          </div>
                          <!-- /.tab-pane -->
                      </div>
                      <!-- /.tab-content -->
                  </div>
              </div>
              <div class="tab-pane no-padding" id="b">
                <div class="nav-tabs-custom no-shadow">
                  <ul class="nav nav-tabs line-tabs tabs-danger">
                      <li class="active"><a href="#tab_11" data-toggle="tab" aria-expanded="true">DEMO</a></li>
                      <li class=""><a href="#tab_12" data-toggle="tab" aria-expanded="false">JSON数据</a></li>
                  </ul>
                  <div class="tab-content">
                      <!-- /.tab-pane -->
                      <div class="tab-pane" id="tab_12">
                          <code> <pre>
                            var zNodes =[
                            {id:1, pId:0, name:"[core] 基本功能 演示", open:true},
                            {id:101, pId:1, name:"最简单的树 --  标准 JSON 数据", file:"core/standardData"},
                            {id:102, pId:1, name:"最简单的树 --  简单 JSON 数据", file:"core/simpleData"},
                            {id:103, pId:1, name:"不显示 连接线", file:"core/noline"},
                            {id:104, pId:1, name:"不显示 节点 图标", file:"core/noicon"},
                            {id:105, pId:1, name:"自定义图标 --  icon 属性", file:"core/custom_icon"},
                            {id:106, pId:1, name:"自定义图标 --  iconSkin 属性", file:"core/custom_iconSkin"},
                            {id:107, pId:1, name:"自定义字体", file:"core/custom_font"},
                            {id:115, pId:1, name:"超链接演示", file:"core/url"},
                            {id:108, pId:1, name:"异步加载 节点数据", file:"core/async"},
                            {id:109, pId:1, name:"用 zTree 方法 异步加载 节点数据", file:"core/async_fun"},
                            {id:110, pId:1, name:"用 zTree 方法 更新 节点数据", file:"core/update_fun"},
                            {id:111, pId:1, name:"单击 节点 控制", file:"core/click"},
                            {id:112, pId:1, name:"展开 / 折叠 父节点 控制", file:"core/expand"},
                            {id:113, pId:1, name:"根据 参数 查找 节点", file:"core/searchNodes"},
                            {id:114, pId:1, name:"其他 鼠标 事件监听", file:"core/otherMouse"},
    
                            {id:2, pId:0, name:"[excheck] 复/单选框功能 演示", open:false},
                            {id:201, pId:2, name:"Checkbox 勾选操作", file:"excheck/checkbox"},
                            {id:206, pId:2, name:"Checkbox nocheck 演示", file:"excheck/checkbox_nocheck"},
                            {id:207, pId:2, name:"Checkbox chkDisabled 演示", file:"excheck/checkbox_chkDisabled"},
                            {id:208, pId:2, name:"Checkbox halfCheck 演示", file:"excheck/checkbox_halfCheck"},
                            {id:202, pId:2, name:"Checkbox 勾选统计", file:"excheck/checkbox_count"},
                            {id:203, pId:2, name:"用 zTree 方法 勾选 Checkbox", file:"excheck/checkbox_fun"},
                            {id:204, pId:2, name:"Radio 勾选操作", file:"excheck/radio"},
                            {id:209, pId:2, name:"Radio nocheck 演示", file:"excheck/radio_nocheck"},
                            {id:210, pId:2, name:"Radio chkDisabled 演示", file:"excheck/radio_chkDisabled"},
                            {id:211, pId:2, name:"Radio halfCheck 演示", file:"excheck/radio_halfCheck"},
                            {id:205, pId:2, name:"用 zTree 方法 勾选 Radio", file:"excheck/radio_fun"},
    
                            {id:3, pId:0, name:"[exedit] 编辑功能 演示", open:false},
                            {id:301, pId:3, name:"拖拽 节点 基本控制", file:"exedit/drag"},
                            {id:302, pId:3, name:"拖拽 节点 高级控制", file:"exedit/drag_super"},
                            {id:303, pId:3, name:"用 zTree 方法 移动 / 复制 节点", file:"exedit/drag_fun"},
                            {id:304, pId:3, name:"基本 增 / 删 / 改 节点", file:"exedit/edit"},
                            {id:305, pId:3, name:"高级 增 / 删 / 改 节点", file:"exedit/edit_super"},
                            {id:306, pId:3, name:"用 zTree 方法 增 / 删 / 改 节点", file:"exedit/edit_fun"},
                            {id:307, pId:3, name:"异步加载 & 编辑功能 共存", file:"exedit/async_edit"},
                            {id:308, pId:3, name:"多棵树之间 的 数据交互", file:"exedit/multiTree"},
    
                            {id:4, pId:0, name:"大数据量 演示", open:false},
                            {id:401, pId:4, name:"一次性加载大数据量", file:"bigdata/common"},
                            {id:402, pId:4, name:"分批异步加载大数据量", file:"bigdata/diy_async"},
                            {id:403, pId:4, name:"分批异步加载大数据量", file:"bigdata/page"},
    
                            {id:5, pId:0, name:"组合功能 演示", open:false},
                            {id:501, pId:5, name:"冻结根节点", file:"super/oneroot"},
                            {id:502, pId:5, name:"单击展开/折叠节点", file:"super/oneclick"},
                            {id:503, pId:5, name:"保持展开单一路径", file:"super/singlepath"},
                            {id:504, pId:5, name:"添加 自定义控件", file:"super/diydom"},
                            {id:505, pId:5, name:"checkbox / radio 共存", file:"super/checkbox_radio"},
                            {id:506, pId:5, name:"左侧菜单", file:"super/left_menu"},
                            {id:513, pId:5, name:"OutLook 样式的左侧菜单", file:"super/left_menuForOutLook"},
                            {id:507, pId:5, name:"下拉菜单", file:"super/select_menu"},
                            {id:509, pId:5, name:"带 checkbox 的多选下拉菜单", file:"super/select_menu_checkbox"},
                            {id:510, pId:5, name:"带 radio 的单选下拉菜单", file:"super/select_menu_radio"},
                            {id:508, pId:5, name:"右键菜单 的 实现", file:"super/rightClickMenu"},
                            {id:511, pId:5, name:"与其他 DOM 拖拽互动", file:"super/dragWithOther"},
                            {id:512, pId:5, name:"异步加载模式下全部展开", file:"super/asyncForAll"},
    
                            {id:6, pId:0, name:"其他扩展功能 演示", open:false},
                            {id:601, pId:6, name:"隐藏普通节点", file:"exhide/common"},
                            {id:602, pId:6, name:"配合 checkbox 的隐藏", file:"exhide/checkbox"},
                            {id:603, pId:6, name:"配合 radio 的隐藏", file:"exhide/radio"}
                        ];
                var setting = {
                    view: {
                        dblClickExpand: false,
                        showLine: true,
                        selectedMulti: false                  
                    },
                    check:{
                        enable:true
                    },
                    data: {
                        simpleData: {
                            enable:true,
                            idKey: "id",
                            pIdKey: "pId",
                            rootPId: ""
                        }
                    },
                    callback: {
                        beforeClick: function(treeId, treeNode) {
                            var zTree = $.fn.zTree.getZTreeObj("tree");
                            if (treeNode.isParent) {
                                zTree.expandNode(treeNode);
                                return false;
                            } else {
                                // demoIframe.attr("src",treeNode.file + ".html");
                                return true;
                            }
                        }
                    }
                };
                $.fn.zTree.init($("#tree"),setting,zNodes);  
                          </pre>
                          </code>
                      </div>

                      <div class="tab-pane active" id="tab_11">
                        <ul id="tree" class="ztree"></ul>
                      </div>
                      <!-- /.tab-pane -->
                  </div>
                  <!-- /.tab-content -->
              </div>
              </div>
					</div>
				</div>
    </section>
    <!-- jQuery 3 -->
    <script src="../../dist/js/jquery.min.js"></script>
    <script src="../../dist/js/lanai-ui.min.js"></script>
    <script>
      $(function(){
          var zNodes =[
                      {id:1, pId:0, name:"[core] 基本功能 演示", open:true},
                      {id:101, pId:1, name:"最简单的树 --  标准 JSON 数据", file:"core/standardData"},
                      {id:102, pId:1, name:"最简单的树 --  简单 JSON 数据", file:"core/simpleData"},
                      {id:103, pId:1, name:"不显示 连接线", file:"core/noline"},
                      {id:104, pId:1, name:"不显示 节点 图标", file:"core/noicon"},
                      {id:105, pId:1, name:"自定义图标 --  icon 属性", file:"core/custom_icon"},
                      {id:106, pId:1, name:"自定义图标 --  iconSkin 属性", file:"core/custom_iconSkin"},
                      {id:107, pId:1, name:"自定义字体", file:"core/custom_font"},
                      {id:115, pId:1, name:"超链接演示", file:"core/url"},
                      {id:108, pId:1, name:"异步加载 节点数据", file:"core/async"},
                      {id:109, pId:1, name:"用 zTree 方法 异步加载 节点数据", file:"core/async_fun"},
                      {id:110, pId:1, name:"用 zTree 方法 更新 节点数据", file:"core/update_fun"},
                      {id:111, pId:1, name:"单击 节点 控制", file:"core/click"},
                      {id:112, pId:1, name:"展开 / 折叠 父节点 控制", file:"core/expand"},
                      {id:113, pId:1, name:"根据 参数 查找 节点", file:"core/searchNodes"},
                      {id:114, pId:1, name:"其他 鼠标 事件监听", file:"core/otherMouse"},

                      {id:2, pId:0, name:"[excheck] 复/单选框功能 演示", open:false},
                      {id:201, pId:2, name:"Checkbox 勾选操作", file:"excheck/checkbox"},
                      {id:206, pId:2, name:"Checkbox nocheck 演示", file:"excheck/checkbox_nocheck"},
                      {id:207, pId:2, name:"Checkbox chkDisabled 演示", file:"excheck/checkbox_chkDisabled"},
                      {id:208, pId:2, name:"Checkbox halfCheck 演示", file:"excheck/checkbox_halfCheck"},
                      {id:202, pId:2, name:"Checkbox 勾选统计", file:"excheck/checkbox_count"},
                      {id:203, pId:2, name:"用 zTree 方法 勾选 Checkbox", file:"excheck/checkbox_fun"},
                      {id:204, pId:2, name:"Radio 勾选操作", file:"excheck/radio"},
                      {id:209, pId:2, name:"Radio nocheck 演示", file:"excheck/radio_nocheck"},
                      {id:210, pId:2, name:"Radio chkDisabled 演示", file:"excheck/radio_chkDisabled"},
                      {id:211, pId:2, name:"Radio halfCheck 演示", file:"excheck/radio_halfCheck"},
                      {id:205, pId:2, name:"用 zTree 方法 勾选 Radio", file:"excheck/radio_fun"},

                      {id:3, pId:0, name:"[exedit] 编辑功能 演示", open:false},
                      {id:301, pId:3, name:"拖拽 节点 基本控制", file:"exedit/drag"},
                      {id:302, pId:3, name:"拖拽 节点 高级控制", file:"exedit/drag_super"},
                      {id:303, pId:3, name:"用 zTree 方法 移动 / 复制 节点", file:"exedit/drag_fun"},
                      {id:304, pId:3, name:"基本 增 / 删 / 改 节点", file:"exedit/edit"},
                      {id:305, pId:3, name:"高级 增 / 删 / 改 节点", file:"exedit/edit_super"},
                      {id:306, pId:3, name:"用 zTree 方法 增 / 删 / 改 节点", file:"exedit/edit_fun"},
                      {id:307, pId:3, name:"异步加载 & 编辑功能 共存", file:"exedit/async_edit"},
                      {id:308, pId:3, name:"多棵树之间 的 数据交互", file:"exedit/multiTree"},

                      {id:4, pId:0, name:"大数据量 演示", open:false},
                      {id:401, pId:4, name:"一次性加载大数据量", file:"bigdata/common"},
                      {id:402, pId:4, name:"分批异步加载大数据量", file:"bigdata/diy_async"},
                      {id:403, pId:4, name:"分批异步加载大数据量", file:"bigdata/page"},

                      {id:5, pId:0, name:"组合功能 演示", open:false},
                      {id:501, pId:5, name:"冻结根节点", file:"super/oneroot"},
                      {id:502, pId:5, name:"单击展开/折叠节点", file:"super/oneclick"},
                      {id:503, pId:5, name:"保持展开单一路径", file:"super/singlepath"},
                      {id:504, pId:5, name:"添加 自定义控件", file:"super/diydom"},
                      {id:505, pId:5, name:"checkbox / radio 共存", file:"super/checkbox_radio"},
                      {id:506, pId:5, name:"左侧菜单", file:"super/left_menu"},
                      {id:513, pId:5, name:"OutLook 样式的左侧菜单", file:"super/left_menuForOutLook"},
                      {id:507, pId:5, name:"下拉菜单", file:"super/select_menu"},
                      {id:509, pId:5, name:"带 checkbox 的多选下拉菜单", file:"super/select_menu_checkbox"},
                      {id:510, pId:5, name:"带 radio 的单选下拉菜单", file:"super/select_menu_radio"},
                      {id:508, pId:5, name:"右键菜单 的 实现", file:"super/rightClickMenu"},
                      {id:511, pId:5, name:"与其他 DOM 拖拽互动", file:"super/dragWithOther"},
                      {id:512, pId:5, name:"异步加载模式下全部展开", file:"super/asyncForAll"},

                      {id:6, pId:0, name:"其他扩展功能 演示", open:false},
                      {id:601, pId:6, name:"隐藏普通节点", file:"exhide/common"},
                      {id:602, pId:6, name:"配合 checkbox 的隐藏", file:"exhide/checkbox"},
                      {id:603, pId:6, name:"配合 radio 的隐藏", file:"exhide/radio"}
                  ];
          var setting = {
              view: {
                  dblClickExpand: false,
                  showLine: true,
                  selectedMulti: false                  
              },
              check:{
                  enable:true
              },
              data: {
                  simpleData: {
                      enable:true,
                      idKey: "id",
                      pIdKey: "pId",
                      rootPId: ""
                  }
              },
              callback: {
                  beforeClick: function(treeId, treeNode) {
                      var zTree = $.fn.zTree.getZTreeObj("tree");
                      if (treeNode.isParent) {
                          zTree.expandNode(treeNode);
                          return false;
                      } else {
                          // demoIframe.attr("src",treeNode.file + ".html");
                          return true;
                      }
                  }
              }
          };
          $.fn.zTree.init($("#tree"),setting,zNodes);        
      })
  </script>
    <script type="text/javascript">
        $(function () {

            var defaultData = [
              {
                  text: 'Parent 1',
                  href: '#parent1',
                  tags: ['4'],
                  nodes: [
                    {
                        text: 'Child 1',
                        href: '#child1',
                        tags: ['2'],
                        nodes: [
                          {
                              text: 'Grandchild 1',
                              href: '#grandchild1',
                              tags: ['0']
                          },
                          {
                              text: 'Grandchild 2',
                              href: '#grandchild2',
                              tags: ['0']
                          }
                        ]
                    },
                    {
                        text: 'Child 2',
                        href: '#child2',
                        tags: ['0']
                    }
                  ]
              },
              {
                  text: 'Parent 2',
                  href: '#parent2',
                  tags: ['0']
              },
              {
                  text: 'Parent 3',
                  href: '#parent3',
                  tags: ['0']
              },
              {
                  text: 'Parent 4',
                  href: '#parent4',
                  tags: ['0']
              },
              {
                  text: 'Parent 5',
                  href: '#parent5',
                  tags: ['0']
              }
            ];

            // var alternateData = [
            //   {
            //       text: 'Parent 1',
            //       tags: ['2'],
            //       nodes: [
            //         {
            //             text: 'Child 1',
            //             tags: ['3'],
            //             nodes: [
            //               {
            //                   text: 'Grandchild 1',
            //                   tags: ['6']
            //               },
            //               {
            //                   text: 'Grandchild 2',
            //                   tags: ['3']
            //               }
            //             ]
            //         },
            //         {
            //             text: 'Child 2',
            //             tags: ['3']
            //         }
            //       ]
            //   },
            //   {
            //       text: 'Parent 2',
            //       tags: ['7']
            //   },
            //   {
            //       text: 'Parent 3',
            //       icon: 'fa fa-phone',
            //       href: '#demo',
            //       tags: ['11']
            //   },
            //   {
            //       text: 'Parent 4',
            //       icon: 'fa fa-cloud-download',
            //       href: '/demo.html',
            //       tags: ['19'],
            //       selected: true
            //   },
            //   {
            //       text: 'Parent 5',
            //       icon: 'fa fa-certificate',
            //       color: 'pink',
            //       backColor: 'red',
            //       href: 'http://www.tesco.com',
            //       tags: ['available', '0']
            //   }
            // ];

            var json = '[' +
              '{' +
                '"text": "Parent 1",' +
                '"nodes": [' +
                  '{' +
                    '"text": "Child 1",' +
                    '"nodes": [' +
                      '{' +
                        '"text": "Grandchild 1"' +
                      '},' +
                      '{' +
                        '"text": "Grandchild 2"' +
                      '}' +
                    ']' +
                  '},' +
                  '{' +
                    '"text": "Child 2"' +
                  '}' +
                ']' +
              '},' +
              '{' +
                '"text": "Parent 2"' +
              '},' +
              '{' +
                '"text": "Parent 3"' +
              '},' +
              '{' +
                '"text": "Parent 4"' +
              '},' +
              '{' +
                '"text": "Parent 5"' +
              '}' +
            ']';


            $('#treeview1').treeview({
                data: defaultData
            });
        });
    </script>
</body>
</html>
